﻿using M.Warehouse.API.Application.Command.FinishedProductCommand;
using M.Warehouse.Repository.WarehouseInterface;
using MediatR;

namespace M.Warehouse.API.Application.CommandHandlers.FinishedProductHandlers
{
    public class FinishedProductCreateCommandHandlers : IRequestHandler<FinishedProductCreateCommand, int>
    {
        private readonly IFinishedProductRepository _finishedProductRepository;
        public FinishedProductCreateCommandHandlers(IFinishedProductRepository finishedProductRepository)
        {
            _finishedProductRepository = finishedProductRepository;
        }
        /// <summary>
        /// 添加成品
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<int> Handle(FinishedProductCreateCommand request, CancellationToken cancellationToken)
        {
            return await _finishedProductRepository.AddAsync(request);
        }
    }
}
